﻿@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="easyui-layout case" data-options="fit: true">
    <div data-options="region: 'center', border: false" style="padding:10px; overflow: hidden;">
        <div class="easyui-layout" data-options="fit: true">
            <div class="easyui-layout" data-options="fit: true">
                <form class="form-horizontal m15_t" id="form">
                    <div class="tab-content">
                        <div class="tab-pane fade in active" id="home">
                            <div class="form-group">
                                <label class="wd100 control-label"><span class="WdateFmtErr">*</span>From：</label>
                                <div class="wd250 m15_l">
                                    <input class="form-control" type="text" name="from" maxlength="40" autocomplete="off" placeholder="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="wd100 control-label"><span class="WdateFmtErr">*</span>To：</label>
                                <div class="wd250 m15_l">
                                    <input class="form-control" type="text" name="to" maxlength="40" autocomplete="off" placeholder="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="wd100 control-label">&nbsp;</label>
                                <div class="wd250 m15_l">
                                    <button type="button" class="btn btn-default btn-sm active search"><span class="glyphicon glyphicon-add"></span> 保存</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
@section footerScript{
    <script type="text/javascript">

        $(function () {
            $(".search").click(function () {

                var cover = Topro.UI.Mask({
                    obj: $("body"),
                    opacity: 0.5
                });

                var data = $("#form").serializeJSON();

                Topro.Util.Ajax({
                    type: "POST",
                    url: "/Car/SaveCommand",
                    data: data,
                    success: function (res) {
                        if (res.success) {
                            $("input[name='from']").val('');
                            $("input[name='to']").val('');
                            cover.Remove();
                            Topro.UI.Tip_success("操作成功！");
                            Topro.UI.CloseDialog();
                        } else {
                            cover.Remove();
                            Topro.UI.Tip_short_warning("操作失败！" + res.message);
                        }
                    },
                    error: function (json) {
                        cover.Remove();
                        Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                    }
                });

            });
        });
    </script>
}